/*
 * Chat 0.0.1 - 聊天类
 *
 * Copyright (c) 2008 Dalton (9wee.com)
 *
 *
 * $Date: 2008-12-25 $
 * $Rev: 01 $
 *
 --------------------------------------------------
 更新日志


 */

function Chat() {

}


Chat.prototype = {
	//显示聊天框框
	showMessage: function(username, content) {
		if (dom.getById(username) == undefined) return false;
		if (dom.getById("messageContent-" + username) != undefined) {
			dom.getById("messageContent-" + username).innerHTML = content;
			dom.showNode(dom.getById("messageBox-" + username));
			window.clearTimeout(this.showTime);
			this.showTime = window.setTimeout('dom.hideNode(dom.getById("messageBox-' + username + '"));', 5000);
			return true;
		}

		var messageHtml = '<table cellspacing="0" cellpadding="0" id="">'+
							'<tbody>'+
							'<tr>'+
							'<td><img src="images/bubble_topleft.gif"/></td>'+
							'<td style="background-image: url(images/bubble_top.gif);"/>'+
							'<td><img src="images/bubble_topright.gif"/></td></tr>'+

							'<tr>'+
							'<td style="background-image: url(images/bubble_middleleft.gif);"> </td>'+
							'<td id="messageContent-'+ username + '" class="messageContent">' + content + '</td>'+
							'<td style="background-image: url(images/bubble_middleright.gif);"> </td>'+
							'</tr>'+

							'<tr>'+
							'<td><img src="images/bubble_bottomlefts.gif" id="speechBalloonLeft"/></td>'+
							'<td style="background-image: url(images/bubble_bottom.gif);"/>'+
							'<td><img src="images/bubble_bottomright.gif" id="speechBalloonRight"/></td>'+
							'</tr>'+
							'</tbody>'+
						'</table>';
		dom.getById("messageBox-" + username).innerHTML = messageHtml;
		dom.showNode(dom.getById("messageBox-" + username));
		this.showTime = window.setTimeout('dom.hideNode(dom.getById("messageBox-' + username + '"));', 5000);
	}

}